package cn.jbolt.ai.core.chain.node.base;

import cn.jbolt.util.JSONUtil;
import com.fasterxml.jackson.databind.JsonNode;
import com.jboltai.event.chain.TriggerType;


/**
 * 触发配置
 */
public class TriggerConfig {

    /**
     * 触发方式
     */
    private TriggerType triggerType = TriggerType.ALL_OVER;


    public static TriggerConfig from(JsonNode jsonNode) {
        if (jsonNode == null) {
            return new TriggerConfig();
        }
        return JSONUtil.toObject(jsonNode, TriggerConfig.class);


    }

    public TriggerType getTriggerType() {
        return triggerType;
    }

    public void setTriggerType(String triggerType) {
        this.triggerType = TriggerType.valueOf(triggerType);
    }
}
